<%@page import="java.util.HashMap"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date"%>
<%@page import="org.w3c.dom.ls.LSInput"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.awt.List"%>
<%@page import="com.commonfunction.CommFunction"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@taglib prefix="s" uri="/struts-tags"%>    
<!DOCTYPE html>
<html>
<head>
    <title>weighingMachinEntry page</title>
    <link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css" />
	<link rel="stylesheet" href="css/weighingMachinEntry.css" />
    
    <style type="text/css">
    	.errors {
			background-color: #FFCCCC;
			border: 1px solid #CC0000;
			width: 400px;
			margin-bottom: 8px;
		}
		
		.errors li {
			list-style: none;
		}
		
    
    </style>
    <script type="text/javascript"  src="js/jquery-1.10.2.min.js"></script>
	<script type="text/javascript" src="js/weighingMachinEntry.js"></script>
	<script type="text/javascript" src="js/jquery-barcode.min.js"></script>
	<script type="text/javascript">
	$(document).ready(function(){

		 	 $.mobile.ajaxEnabled = false;
		  	 	$(".cnamesearchField").on("input", function(e) {
				var sugList=$('.customersuggestions');
		    	var str="";
		        var text = $(this).val();
		        if(text.length < 1) {
		            sugList.html("");
		            sugList.listview("refresh");
		        } else {
		                $.get("http://server:8080/parvati/Getnameservlet",{methodetocall:'getdealername',name:text,role:'customer'},function(res,code){
							for(var i = 0;i<res.split('#').length-1;i++)
								str += "<li><a href=javascript:addtosearchinputcname('"+res.split('#')[i]+"')>"+res.split('#')[i]+"</a></li>"; 
							 	
							 sugList.html(str);
				             sugList.listview("refresh");
			            });
		               
		        }
						
				});

		  	 	$(".bnamesearchField").on("input", function(e) {
				var sugList=$('.brockersuggestions');
		    	var str="";
		        var text = $(this).val();
		        if(text.length < 1) {
		            sugList.html("");
		            sugList.listview("refresh");
		        } else {
		                $.get("http://server:8080/parvati/Getnameservlet",{methodetocall:'getdealername',name:text,role:'broker'},function(res,code){
							for(var i = 0;i<res.split('#').length-1;i++)
								str += "<li><a href=javascript:addtosearchinputbname('"+res.split('#')[i]+"')>"+res.split('#')[i]+"</a></li>"; 
							 	
							 sugList.html(str);
				             sugList.listview("refresh");
			            });
		        }
				});

		  	 	$.mobile.ajaxEnabled = false;
		  	 	$(".commnamesearchField").on("input", function(e) {
				var sugList=$('.commisionsuggestions');
		    	var str="";
		        var text = $(this).val();
		        if(text.length < 1) {
		            sugList.html("");
		            sugList.listview("refresh");
		        } else {
		                $.get("http://server:8080/parvati/Getnameservlet",{methodetocall:'getdealername',name:text,role:'commisionAgent'},function(res,code){
							for(var i = 0;i<res.split('#').length-1;i++)
								str += "<li><a href=javascript:addtosearchinputcommname('"+res.split('#')[i]+"')>"+res.split('#')[i]+"</a></li>"; 
							 	
							 sugList.html(str);
				             sugList.listview("refresh");
			            });
		               
		        }
						
				});				
	});

	function addtosearchinputcname(text){
		$('.cnamesearchField').val(text);
		$(".customersuggestions").html("");
	}

	function addtosearchinputbname(text){
		$('.bnamesearchField').val(text);
		$(".brockersuggestions").html("");
	}

	function addtosearchinputcommname(text){
		$('.commnamesearchField').val(text);
		$(".commisionsuggestions").html("");
	}
	</script>
	<script type="text/javascript" src="js/jquery.mobile-1.3.2.min.js"></script>
	 
</head>
<body>
	<div data-role="page" id="weighingMachinEntryPage">
		
		<div data-role="header" data-position="fixed" data-theme="b" id="weighingMachinEntryHeader">		
		<a href="menudisplay" data-role="buttun" data-icon="home">Menu</a>
		<h1>Weightments Entry Page</h1> 
		</div>
		<div align="center" data-role="content" id="weighingMachinEntryContent">
			<h1>PARVATI SOLVENTS EXTRACTION PVT LTD</h1>
			<h3>GUT NO.76, KHADGAON,TALUKA: BADNAPUR,DISTRICT:JALNA-431203,MAHARASHTRA,INDIA</h3>
		
			<s:if test="hasActionErrors()">
   			<div class="errors">
      			<s:actionerror/>
   			</div>
			</s:if>		
			
			<form id="weighingMachineForm" action="weightmachinereview" method="POST">
			<div id="tableContainer" class="tableContainer">
			<fieldset>
			<div id="tableDivRegionInfo1" class="tableDivRegion" data-role="fieldcontain">
				<table data-theme="c" border="1" width="80%">
					<tr>
						<td width="20%" class="tableContentTitle"><b>Rst No.</b></td>
						<td width="30%"><input name="rstno" id="RstNoValue" type="text" value="<%=session.getAttribute("rstnum") %>" placeholder="Rst No." class="textBoxClass"/></td>
						<td width="20%" class="tableContentTitle"><b>Vehicle No.</b></td>
						<td width="30%"><input name="vehicleno" id="VehicleNoValue" type="text" value="" placeholder="Vehicle No" class="textBoxClass"/></td>
					
					</tr>
					
					<tr>
						<td width="20%" class="tableContentTitle"><b>Customer Name</b></td>
						<td width="30%">
							<input name="custname" type="text" class="cnamesearchField" placeholder="Search"/>
							<ul class="customersuggestions" data-role="listview" data-inset="true"></ul>
						</td>
						<td width="20%" class="tableContentTitle" rowspan="3"><b>Address</b></td>
						<td width="30%" rowspan="3"><textarea name="address" disabled="disabled" id="customerAddressValue" rows="4" class="textBoxClass"></textarea></td>
					
					</tr>
					<tr>
						<td width="20%" class="tableContentTitle"><b>Commodity</b></td>
						<td width="30%"><input name="commodity" id="commodityValue" type="text" value="" placeholder="Commodity" class="textBoxClass"/></td>
						
					</tr>
					<tr>
						<td width="20%" class="tableContentTitle"><b>Broker Name</b></td>
						<td width="30%">
						<input name="brokername" type="text" class="bnamesearchField" placeholder="Search" onkeyup="loadb()">
						<ul class="brockersuggestions" data-role="listview" data-inset="true"></ul>
						</td>
						
					</tr>
					<tr>
						<td width="20%" class="tableContentTitle"><b>P. O. No.</b></td>
						<td width="30%"><input name="ponum" id="PONovalue" type="text" value="" placeholder="P. O. No." class="textBoxClass" required/></td>
						<td width="20%" class="tableContentTitle"><b>No. Of Bags</b></td>
						<td width="30%"><input name="nobags" id="BagsNoValue" type="number" value="" min="0" placeholder="No. of bags" class="textBoxClass"/></td>
					
					</tr>
					<tr>
						<td width="20%" class="tableContentTitle"><b>Commision Agen</b></td>
						<td width="30%">
						<input name="commisionname" type="text" class="commnamesearchField" placeholder="Search" onkeyup="loadb()">
						<ul class="commisionsuggestions" data-role="listview" data-inset="true"></ul>
						</td>
					</tr>
					
				</table>
				
			</div>
			
			<div id="tableDivRegionInfo2" class="tableDivRegion" data-role="fieldcontain">
			
				<table data-theme="c" border="1" width="80%">
				
					<tr>
						<td width="10%" class="tableContentTitle"><b>Gross Weight  :</b></td>
						<td width="13%"><input name="grossweight" id="grossWeight" type="text" value="" placeholder="Gross Weight" class="textBoxClass"/></td>
						<td width="34%" class="tableContentTitle"><b>Barcode</b></td>
						<td width="10%"class="tableContentTitle"><b>System Date :</b></td>
						<td width="13%"><input name="sysdate" id="SystemDate" value="" type="text" disabled="disabled" placeholder="dd/mm/yyyy" class="textBoxClass"/></td>
					</tr>
					<tr>
						<td width="10%" class="tableContentTitle"><b>Tare Weight  :</b></td>
						<td width="13%"><input name="tareweight" id="tareWeight" type="text" value="" readonly="readonly" placeholder="Tare Weight" class="textBoxClass"/></td>
						<td width="34%" rowspan="3"><div id="barcodeGeneratorDiv" class="barcodeGeneratorDiv"></div></td>
						<td width="10%" class="tableContentTitle" rowspan="2"><b>System time :</b></td>
						<td width="13%" rowspan="2"><input name="systime" id="systime" value="" type="text" disabled="disabled" placeholder="HH:MM" class="textBoxClass"/></td>
					</tr>
					<tr>
						<td width="10%" class="tableContentTitle"><b>Net Weight  :</b></td>
						<td width="13%"><input name="netweight" id="netWeight" type="text" value="" readonly="readonly" placeholder="Net Weight" class="textBoxClass"/></td>
					</tr>
					<tr>
						<td width="10%" class="tableContentTitle"><b>Operator Signature :</b></td>
						<td width="13%"></td>
						<td width="10%" class="tableContentTitle"><b>User ID :</b></td>
						<td width="13%"><input name="userid" id="UserID" type="text" class="textBoxClass" value="<%=session.getAttribute("username")%>" readonly="readonly"/></td>
					</tr>
				
				</table>
			</div>
			</fieldset>
			</div>			
			<div id="submitPageDiv" class="submitPageDiv">
				<button data-theme="a" type="submit" id="generateBarcodeButton">Generate Barcode </button>
			</div>
			</form>
		</div>
	</div>
</body>
</html>